package com.lq.ecoldchain.ui.main.orderlist.order.list

import android.os.Bundle
import com.lq.ecoldchain.R
import com.lq.ecoldchain.base.view.BaseFragment
import com.lq.ecoldchain.databinding.FragmentOrderMineBinding
import org.kodein.di.Kodein
import org.kodein.di.generic.instance

/*
*2018/12/26 0026  15:23
*我的接单 by lq
*/
class MineOrderListFragment:BaseFragment<FragmentOrderMineBinding>(){
    override val layoutId = R.layout.fragment_order_mine
    override val viewDelegate: MineOrderListDelegate by instance()
    private lateinit var myId:String

    override fun initView() {
        binding.delegate = viewDelegate
        val bundle = arguments!!
        myId = bundle.getString(ID_FLAG)!!
        viewDelegate.viewModel.state  = myId
        viewDelegate.viewModel.orderList()
    }

    override val kodein: Kodein = Kodein.lazy {
        extend(parentKodein)
        import(orderKodeinModel)
    }

    companion object {
       const val ID_FLAG = "mine_id"

        fun newInstance(id:String):MineOrderListFragment{
            val fragment  = MineOrderListFragment()
            val bundle = Bundle()
            bundle.putString(ID_FLAG, id)
            fragment.arguments = bundle
            return fragment
        }
    }
}